package zhengyanze.com.aipoemmax.guide.adapter;

import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.ArrayList;

import zhengyanze.com.aipoemmax.R;
import zhengyanze.com.aipoemmax.guide.Constant;
import zhengyanze.com.aipoemmax.guide.activity.MingActivity;
import zhengyanze.com.aipoemmax.guide.bean.LeiXingBean;
import zhengyanze.com.aipoemmax.guide.utils.TypefaceUtil;

import static zhengyanze.com.aipoemmax.guide.activity.MingActivity.LEIXING_KEY;
import static zhengyanze.com.aipoemmax.guide.activity.MingActivity.TITLE_KEY;

/**
 * 筛选适配器
 * Created by MrZheng on 2017/7/24.
 */

public abstract class LeiXingAdapter extends RecyclerView.Adapter<LeiXingAdapter.LeiViewHolder> {
    ArrayList<LeiXingBean> mStrings;
    public LeiXingAdapter(ArrayList<LeiXingBean> mStrings) {
        this.mStrings = mStrings;
    }

    public class LeiViewHolder extends RecyclerView.ViewHolder {
        public TextView tv_leixing;
        public LeiViewHolder(View itemView) {
            super(itemView);
            tv_leixing = itemView.findViewById(R.id.tv_leixing);
        }
    }

    @Override
    public LeiXingAdapter.LeiViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_leixing, parent, false);
        return new LeiViewHolder(view);
    }

    @Override
    public void onBindViewHolder(final LeiXingAdapter.LeiViewHolder holder, final int position) {
        LeiXingBean bean = mStrings.get(position);
        onclickEvent(holder, position, bean);
    }

    public abstract void onclickEvent(LeiXingAdapter.LeiViewHolder holder,int position,LeiXingBean bean);

    @Override
    public int getItemCount() {
        return mStrings.size();
    }
}
